// 统一响应格式工具

// 成功响应
const success = (data = null, message = '操作成功') => {
  return {
    success: true,
    message,
    data,
    timestamp: new Date().toISOString()
  }
}

// 错误响应
const error = (message = '操作失败', code = 500, data = null) => {
  return {
    success: false,
    message,
    code,
    data,
    timestamp: new Date().toISOString()
  }
}

// 分页响应
const paginated = (data, pagination, message = '获取成功') => {
  return {
    success: true,
    message,
    data,
    pagination,
    timestamp: new Date().toISOString()
  }
}

module.exports = {
  success,
  error,
  paginated
}